home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- //
- // Creation Date: June 11, 1997
- // Author: cdt
- //
- // Procedure Name:
- // buildRenderManipMenu
- //
- // Description Name;
- // Script to create the render manip menu.
- //
- // Input Value:
- // Parent menu name
- //
- // Output Value:
- // None
- //
-
- global proc buildRenderManipMenu( string $parent )
- {
- setParent -m $parent;
-
- menu -e -deleteAllItems $parent;
-
- // Data to be filled in from selection list.
- //
-
- string $parentName, $objectName, $objectType;
- int $found = false;
-
- // Match cameras, lights, and spot-lights on the selection list.
- //
- string $selected[] = `ls -selection`;
-
- for ($item in $selected) {
- string $shapes[];
-
- if ( !catch( $shapes = `listRelatives -shapes $item` ) ) {
- // List relatives succeeded, item is a DAG object.
-
- if (size($shapes) == 0) {
- // item is a shape.
- $shapes[0] = $item;
- }
-
- for ($shape in $shapes) {
- $objectType = `objectType $shape`;
-
- if ($objectType == "camera" ||
- $objectType == "spotLight" ||
- $objectType == "pointLight" ||
- $objectType == "volumeLight" ||
- $objectType == "ambientLight" ||
- $objectType == "areaLight" ||
- $objectType == "directionalLight")
- {
- $found = true;
- $parentName = $item;
- $objectName = $shape;
- break;
- }
- }
-
- if ($found)
- break;
- }
- }
-
- // Create the menu items
- //
-
- if ($objectType == "camera") {
- // Menu item for state
-
- int $hasCameraManip = `renderManip -q -state $objectName`;
-
- menuItem -label $parentName -checkBox $hasCameraManip
- -command ("cameraManipMenuCB true "+$parent+" "+$objectName)
- state;
-
- menuItem -divider true;
-
- // Menu items for components
-
- int $v[] = `renderManip -q -camera $objectName`;
-
- menuItem -label "Center of Interest" -checkBox $v[1]
- -command ("cameraManipMenuCB false "+$parent+" "+$objectName)
- m0;
-
- menuItem -label "Pivot" -checkBox $v[2]
- -command ("cameraManipMenuCB false "+$parent+" "+$objectName)
- m1;
-
- menuItem -label "Clipping Planes" -checkBox $v[3]
- -command ("cameraManipMenuCB false "+$parent+" "+$objectName)
- m2;
-
- menuItem -label "Cycling Index" -checkBox $v[0]
- -command ("cameraManipMenuCB false "+$parent+" "+$objectName)
- m3;
- }
- else if ($objectType == "spotLight") {
- int $hasSpotManip = `renderManip -q -state $objectName`;
-
- menuItem -label $parentName -checkBox $hasSpotManip
- -command ("spotManipMenuCB true "+$parent+" "+$objectName)
- state;
-
- menuItem -divider true;
-
- int $v[] = `renderManip -q -spotLight $objectName`;
-
- menuItem -label "Center of Interest" -checkBox $v[1]
- -command ("spotManipMenuCB false "+$parent+" "+$objectName)
- m0;
-
- menuItem -label "Pivot" -checkBox $v[2]
- -command ("spotManipMenuCB false "+$parent+" "+$objectName)
- m1;
-
- menuItem -label "Cone Angle" -checkBox $v[3]
- -command ("spotManipMenuCB false "+$parent+" "+$objectName)
- m2;
-
- menuItem -label "Penumbra" -checkBox $v[4]
- -command ("spotManipMenuCB false "+$parent+" "+$objectName)
- m3;
-
- menuItem -label "Look Through Barn Doors" -checkBox $v[5]
- -command ("spotManipMenuCB false "+$parent+" "+$objectName)
- m4;
-
- menuItem -label "Decay Regions" -checkBox $v[6]
- -command ("spotManipMenuCB false "+$parent+" "+$objectName)
- m5;
-
- menuItem -label "Cycling Index" -checkBox $v[0]
- -command ("spotManipMenuCB false "+$parent+" "+$objectName)
- m6;
- }
- else if ($objectType == "pointLight" ||
- $objectType == "volumeLight" ||
- $objectType == "ambientLight" ||
- $objectType == "areaLight" ||
- $objectType == "directionalLight")
- {
- int $hasLightManip = `renderManip -q -state $objectName`;
-
- menuItem -label $parentName -checkBox $hasLightManip
- -command ("lightManipMenuCB true "+$parent+" "+$objectName)
- state;
-
- menuItem -divider true;
-
- int $v[] = `renderManip -q -light $objectName`;
-
- menuItem -label "Center of Interest" -checkBox $v[1]
- -command ("lightManipMenuCB false "+$parent+" "+$objectName)
- m0;
-
- menuItem -label "Pivot" -checkBox $v[2]
- -command ("lightManipMenuCB false "+$parent+" "+$objectName)
- m1;
-
- menuItem -label "Cycling Index" -checkBox $v[0]
- -command ("lightManipMenuCB false "+$parent+" "+$objectName)
- m2;
- }
- else {
- menuItem -l "Select Camera or Light" -en false;
- }
- }
-
- global proc cameraManipMenuCB(
- int $stateChanged, string $parent, string $object )
- {
- setParent -m $parent;
-
- int $state, $v[5];
-
- if ($stateChanged) {
- $state = `menuItem -q -checkBox state`;
-
- renderManip -e -state $state $object;
- }
- else {
- $v[0] = `menuItem -q -checkBox m3`;
- $v[1] = `menuItem -q -checkBox m0`;
- $v[2] = `menuItem -q -checkBox m1`;
- $v[3] = `menuItem -q -checkBox m2`;
- $v[4] = false;
-
- renderManip -e -camera $v[0] $v[1] $v[2] $v[3] $v[4] $object;
- }
-
- // A change in state will change component visibility
-
- $state = `renderManip -q -state $object`;
- menuItem -e -checkBox $state state;
-
- $v = `renderManip -q -camera $object`;
- menuItem -e -checkBox $v[0] m3;
- menuItem -e -checkBox $v[1] m0;
- menuItem -e -checkBox $v[2] m1;
- menuItem -e -checkBox $v[3] m2;
- }
-
- global proc spotManipMenuCB(
- int $stateChanged, string $parent, string $object )
- {
- setParent -m $parent;
-
- int $state, $v[7];
-
- if ($stateChanged) {
- $state = `menuItem -q -checkBox state`;
-
- renderManip -e -state $state $object;
- }
- else {
- $v[0] = `menuItem -q -checkBox m6`;
- $v[1] = `menuItem -q -checkBox m0`;
- $v[2] = `menuItem -q -checkBox m1`;
- $v[3] = `menuItem -q -checkBox m2`;
- $v[4] = `menuItem -q -checkBox m3`;
- $v[5] = `menuItem -q -checkBox m4`;
- $v[6] = `menuItem -q -checkBox m5`;
-
- renderManip -e
- -spotLight $v[0] $v[1] $v[2] $v[3] $v[4] $v[5] $v[6] $object;
- }
-
- // A change in state will change component visibility
-
- $state = `renderManip -q -state $object`;
- menuItem -e -checkBox $state state;
-
- $v = `renderManip -q -spotLight $object`;
- menuItem -e -checkBox $v[0] m6;
- menuItem -e -checkBox $v[1] m0;
- menuItem -e -checkBox $v[2] m1;
- menuItem -e -checkBox $v[3] m2;
- menuItem -e -checkBox $v[4] m3;
- menuItem -e -checkBox $v[5] m4;
- menuItem -e -checkBox $v[6] m5;
- }
-
- global proc lightManipMenuCB(
- int $stateChanged, string $parent, string $object )
- {
- setParent -m $parent;
-
- int $state, $v[3];
-
- if ($stateChanged) {
- $state = `menuItem -q -checkBox state`;
-
- renderManip -e -state $state $object;
- }
- else {
- $v[0] = `menuItem -q -checkBox m2`;
- $v[1] = `menuItem -q -checkBox m0`;
- $v[2] = `menuItem -q -checkBox m1`;
-
- renderManip -e -light $v[0] $v[1] $v[2] $object;
- }
-
- // A change in state will change component visibility
-
- $state = `renderManip -q -state $object`;
- menuItem -e -checkBox $state state;
-
- $v = `renderManip -q -light $object`;
- menuItem -e -checkBox $v[0] m2;
- menuItem -e -checkBox $v[1] m0;
- menuItem -e -checkBox $v[2] m1;
- }
-